cmake_minimum_required(VERSION 3.5)
project(usb_camera_publisher)

# 设置C++标准
set(CMAKE_CXX_STANDARD 14)

# 查找需要的包
find_package(GDAL REQUIRED)
find_package(CURL REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(image_transport REQUIRED)
find_package(OpenCV REQUIRED)

# 包的包含路径
include_directories(
  include
  ${OpenCV_INCLUDE_DIRS}
)

# 可执行文件
add_executable(usb_camera_publisher src/usb_camera_publisher.cpp)

# 链接依赖库
target_link_libraries(usb_camera_publisher
  ${GDAL_LIBRARIES}
  ${CURL_LIBRARIES}
  ${OpenCV_LIBS}
  ${cv_bridge_LIBRARIES}
)

# 添加依赖包
ament_target_dependencies(usb_camera_publisher
  rclcpp
  sensor_msgs
  cv_bridge
  image_transport
)

install(TARGETS
  usb_camera_publisher
  DESTINATION lib/${PROJECT_NAME}
)

ament_package()
